# coding:utf8

import os

import tornado.ioloop
import tornado.options
import tornado.web

import config
import user

urls = user.urls.ctrls

PORT = 8888
settings = dict(
    blog_title=u"Tornado Blog",
    template_path=os.path.join(os.path.dirname(__file__), "views"),
    static_path=os.path.join(os.path.dirname(__file__), "static"),
    # ui_modules={"Entry": EntryModule},
    # xsrf_cookies=True,
    cookie_secret=config.cookie_secret,
    login_url="/wx/login",
    debug=True,
)


def make_app():
    # tornado.options.options.log_to_stderr = True
    # tornado.options.options.log_file_prefix = '/Users/shenyufeng/Desktop/my_app.log'
    # tornado.log.enable_pretty_logging(tornado.options.options)
    application = tornado.web.Application(urls, **settings)

    # application.sentry_client = AsyncSentryClient('http://5e4fa25feae3438a8d7100a2ac08f87f@sentry.shuwtech.com/2')
    return application


if __name__ == "__main__":
    app = make_app()
    app.listen(PORT)
    print("http://localhost:%d/" % PORT)
    tornado.ioloop.IOLoop.current().start()
